<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path1 = request.getContextPath();
	String basePath1 = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path1 + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath1%>">
<title>首页</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!-- 根据设备宽度，调整缩放比例 -->
<meta name="viewport" content="width=device-width, initial-scale=1">

<style>
.s1 {
	padding-top: 40px;
}
</style>
<script type="text/javascript">
	
		 function projectList(userId){
			
			 
			$.post("${ pageContext.request.contextPath }/project/selectJoinProjectList",{"userId":userId},function(data){
				 $("#selectProjectId").html("");
				
				 if(data == null ||data == ""){
					 $("#selectProjectId").append("<li><a href='${base}/project/create'>您还没有参与任何项目，去创建一个项目吧</a></li>");
					 
				 }else{
					 $(data).each(function(i,n){
							
							$("#selectProjectId").append("<li><a  href='${ pageContext.request.contextPath }/project/selectJoinProject?userId="+userId+"&projectId="+n.id+"' >"+n.projectName+"</a></li>");
							
						}); 
				}
					
			},"json");
			
		} 
		
		
	
</script>
</head>
<body>
	<!--整体div-->
	<div class="container" >
		<!--Logon部分DIV-->
		<div class="row">
			<div class="col-md-4">
				<img height="100" src="img/telecom.jpg" />
			</div>
			<div class="col-md-4 "></div>
			<div class="col-md-4 s1">
				
				<%-- <li class="dropdown"><a href="#" class="dropdown-toggle"
							data-toggle="dropdown" role="button" aria-haspopup="true"
							aria-expanded="false">${project.projectName}<span class="caret"></span></a>
							<ul class="dropdown-menu">
								<li><a href="#"></a></li>
								<li><a href="#"></a></li>
							</ul>
				</li> --%>
			
			
			
				<%-- <ul class="dropdown-menu" href="${base}/project/projectList"><b> ${project.projectName}</b> </ul>   --%>
				
				
				<c:if test="${user==null}">
					<a style="font-size: 15" href="${pageContext.request.contextPath}/login.jsp"><b>登录</b></a> <a style="font-size: 15"  href="${pageContext.request.contextPath}/regist.jsp"><b>注册</b></a>
				</c:if>
				
				<c:if test="${user != null}">
					<c:if test="${project == null}">
						<li class="dropdown"><a style="font-size: 15"   class="dropdown-toggle"
									data-toggle="dropdown" role="button" aria-haspopup="true"
									aria-expanded="false" onclick="projectList(${user.id})" ><b >请选择项目</b><span class="caret"></span></a>
									<ul id="selectProjectId" class="dropdown-menu">  </ul>  
										
									</ul>
									<span class="glyphicon glyphicon-user" aria-hidden="true"></span><a  style="font-size: 15" ><b>你好，${user.name}</b></a>
						</li>
					</c:if>
					<c:if test="${project != null}">
						<li class="dropdown"><a  class="dropdown-toggle"
									data-toggle="dropdown" role="button" aria-haspopup="true"
									aria-expanded="false" onclick="projectList(${user.id})" ><b id="projectName" style="font-size:15 ">当前项目：${project.projectName}</b><span class="glyphicon glyphicon-triangle-bottom"></span></a>
									<ul id="selectProjectId" class="dropdown-menu">  </ul>  
										
									</ul>
									
									<span class="glyphicon glyphicon-user" aria-hidden="true"></span><a style="font-size: 15"  ><b>你好，${user.name}</b></a>
						</li>
					</c:if>
					
					<a href="${pageContext.request.contextPath}/user/loginOut"><b>退出登录</b></a>
				</c:if>
				
			</div>
		</div>
		<!--导航条部分DIV-->
		<div class="row">
			<nav class="navbar navbar-default">
			<div class="container-fluid">
				<!-- Brand and toggle get grouped for better mobile display -->
				<div class="navbar-header">
					<button type="button" class="navbar-toggle collapsed"
						data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"
						aria-expanded="false">
						<span class="sr-only">Toggle navigation</span> <span
							class="icon-bar"></span> <span class="icon-bar"></span> <span
							class="icon-bar"></span>
					</button>
					<a class="navbar-brand" href="#" style="background-color: #080808;">首页</a>
				</div>

				<!-- Collect the nav links, forms, and other content for toggling -->
				<div class="collapse navbar-collapse"
					id="bs-example-navbar-collapse-1"
					style="background-color:  #080808;">
					<ul class="nav navbar-nav">
			
					<%-- 	<li><a href="${base}/project/projectList">项目管理</a></li> --%>
						<li class="li1" style="background-color:  #080808;"><a href="${base}/project/findUnFinishProjects?userId=${user.id}">项目管理</a></li>
						
						
						<li  class="dropdown li2" style="background-color:  #080808;"><a href="#" class="dropdown-toggle"
							data-toggle="dropdown" role="button" aria-haspopup="true"
							aria-expanded="false">表格管理 <span class="caret"></span></a>
							<ul class="dropdown-menu">
								<%-- <li><a href="${base}/excel/list">编辑</a></li>
								<li><a href="${base}/excel/scan">查看</a></li> --%>
								<li><a href="${pageContext.request.contextPath}/table/joinTableList?projectId=${project.id}&userId=${user.id}">未完成表格</a></li>
								<li><a href="${pageContext.request.contextPath}/table/finishList?projectId=${project.id}">已完成表格</a></li>
							
								<%-- <li><a href="${base}/createTable.jsp">添加表格</a></li> --%>
								<li><a href="${pageContext.request.contextPath}/tpl/addTable">添加表格</a></li>
							
								
							</ul>
						</li>
						
						<%-- <li class="dropdown"><a href="#" class="dropdown-toggle"
							data-toggle="dropdown" role="button" aria-haspopup="true"
							aria-expanded="false">模板管理 <span class="caret"></span></a>
							<ul class="dropdown-menu">
								<li><a href="${base}/createTemplate.jsp">新建模板</a></li>
								<li><a href="${base}/excel/list">编辑</a></li>
								<li><a href="${base}/excel/scan">查看</a></li>
								<li><a href="${pageContext.request.contextPath}/tpl/templateList">模板管理</a></li>
								<li><a href="${base}/uploadTemplate.jsp">上传模板</a></li>
							</ul>
						</li> --%>
						
						<li class="li3" style="background-color:  #080808;"><a href="${pageContext.request.contextPath}/tpl/templateList">模板管理</a></li>
						
						<li class="li4" style="background-color:  #080808;"><a href="${pageContext.request.contextPath}/user/userInfo?userId=${user.id}">个人中心</a></li>
						
						<!-- <li class="dropdown"><a href="#" class="dropdown-toggle"
							data-toggle="dropdown" role="button" aria-haspopup="true"
							aria-expanded="false">个人中心<span class="caret"></span></a>
							<ul class="dropdown-menu">
								<li><a href="#">个人信息管理</a></li>
								<li><a href="#">订阅列表</a></li>
							</ul>
						</li> -->
						
						<%-- <li><a href="${base}/upload.jsp">导入本地excel文件</a></li> --%>
						
						
						
					</ul>
					<form class="navbar-form navbar-right" role="search" >
						<div class="form-group" >
							<input type="text" class="form-control" placeholder="请输入...">
						</div>
						<button type="submit" class="btn btn-default">搜索</button>
					</form>

				</div>
				<!-- /.navbar-collapse -->
			</div>
			<!-- /.container-fluid --> </nav>
		</div>



	</div>
</body>
<script type="text/javascript">
		$(".li1").bind("click", function() {
			$(this).css("background-color", "#ffffff");
			$(".li2").css("background-color", "#080808");
			$(".li3").css("background-color", "#080808");
			$(".li4").css("background-color", "#080808");
		})
		$(".trr").bind("mouseout", function() {
			$(this).css("background-color", "#ffffff");
		})
</script>

<%-- <body>
  		<h1><a href="${base}/excel/list" style="text-decoration:none;">文件列表(可编辑)</a></h1>
        <h1><a href="${base}/excel/scan" style="text-decoration:none;" >文件列表(只读)</a></h1>
        <h1> <a href="${base}/upload.jsp" style="text-decoration:none;" >导入Excel文件</a></h1>
  </body> --%>
</html>